package com.hjj.concurrence.syncMethod.t11;

/**
 * holdsLock 方法的作用是当 currentThread 在指定的对象上保持锁定时，才返回 true
 */
public class Test1 {
    public static void main(String[] args) {
        System.out.println("A " + Thread.currentThread().holdsLock(Test1.class));
        synchronized (Test1.class){
            System.out.println("B " + Thread.currentThread().holdsLock(Test1.class));
        }
        System.out.println("C " + Thread.currentThread().holdsLock(Test1.class));
    }
}
